package cn.source.zk.mapper;

import cn.source.zk.domain.entity.Device;
import cn.source.zk.domain.vo.DeviceChannelVO;
import cn.source.zk.domain.vo.DeviceSortVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

@Mapper
public interface ZkDeviceMapper {

    /**
     * 获取设备主表分页列表
     * @param device
     * @return
     */
    List<Device> selectListPage(@Param("device") Device device,
                                @Param("substationsNumList") List<Long> substationsNumList);

    List<DeviceChannelVO> selectListPageFold(@Param("device") Device device,
                                             @Param("substationsNumList") List<Long> substationsNumList,@Param("userId") Long userId);

    Map<String, Object> selectDeviceStats();



    /**
     * 新增设备
     * @param device
     * @return
     */
    int add(Device device);


    List<Device> selectLostSignalDevices();


    /**
     * 修改设备
     * @param device
     * @return
     */
    int edit(Device device);

    List<Device> selectDeviceByNotAuth(Device device);

    /**
     * 删除详细表信息
     * @param nums
     * @return
     */
    int removeBatch(@Param("nums") List<Long> nums);

    /**
     * 批量修改设备状态
     * @param zhGuids
     * @return
     */
    int editBatchStated(@Param("zhGuids") List<String> zhGuids);

    Device getByNum(@Param("num") Long num);

    List<Device> getByDevModel(@Param("nums") List<Long> nums);

    List<Device> getBySubstationNums(@Param("nums") List<Long> nums);

    List<Device> getByDevNum(@Param("devNum") String devNum);

    List<DeviceSortVO> getSortList();

    Device getByZhGuid(@Param("zhGuid") String zhGuid);

    int updateDeviceStatus();
    int updateDeviceNoDataStatus();
}
